package sketchml;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class SMLNode {

	private String name;

	private List children;

	private Map<String,String> attributes;

	public SMLNode() {
		init();
	}

	private void init() {
		children = new ArrayList();
		attributes = new HashMap<String,String>();
	}

	public void setName(String n) {
		name = n;
	}

	public String getName() {
		return name;
	}

	public List getChildren() {
		return Collections.unmodifiableList(children);
	}

	public Map getAttributes() {
		return Collections.unmodifiableMap(attributes);
	}

	public boolean appendChild(SMLNode node) {
		return children.add(node);
	}

	public String setAttribute(String name, String value) {
		return attributes.put(name, value);
	}

	public String getAttribute(String name) {
		return attributes.get(name);
	}

}
